﻿using System;
using System.Collections;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList s1 = new ArrayList();

            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine("请输入成绩");
                double d = double.Parse(Console.ReadLine());
                Console.WriteLine("你输入的成绩为"+d);
                Text();
                s1.Add(d);
            }
            Console.WriteLine("学生总数为");
            double sum = 0;
            for (int i = 0; i < s1; i++)
            {
                sum = sum = (double)s1[1];
            }
            Console.WriteLine("总分为"+sum);
            double avg = sum / s1.Count;
            Console.WriteLine("平均分为"+avg);
            Console.ReadKey();
        }

        private static void Text()
        {
            try
            {
                Console.WriteLine("请输入成绩");
                double d = double.Parse(Console.ReadLine());
                Console.WriteLine("你输入的成绩为");
            }
            catch (FormatException e)

            {

                Console.WriteLine("处理异常");
            }
            catch (OverflowException)
            { Console.WriteLine("处理异常"); }
            catch (Exception)
            { Console.WriteLine("处理异常"); }
            finally
            { Console.WriteLine("处理异常"); }
        }
    }
}
